var UserData=require('UserData')

cc.Class({
    extends: cc.Component,

    properties: {
        sharePromptBackground:{
            default:null,
            type:cc.Node
        },
        FlyObjPrefab:{
            default:null,
            type:cc.Prefab
        },
    },

    // LIFE-CYCLE CALLBACKS:

    // onLoad () {},

    start () {
        if(UserData.videoAdInterval<10000){
            UserData.videoAdInterval =10000
        }
        setInterval(()=>{
            this.flyObjTask()
        },UserData.videoAdInterval?UserData.videoAdInterval:50000)
    },
    flyObjTask(){
        if(!this.FlyObj ||!this.FlyObj.parent){
            this.FlyObj = cc.instantiate(this.FlyObjPrefab)
            this.node.insertChild(this.FlyObj,5)
            this.FlyObj.getComponent("FlytinObject").sharePromptBackground = this.sharePromptBackground
            this.FlyObj.getComponent("FlytinObject").fly()    
        }
            
    }


    // update (dt) {},
});
